import { createRouter, createWebHistory } from "vue-router";

import Home from "@/views/demo/home.vue";

// 2. 定义一些路由
// 每个路由都需要映射到一个组件
// 我们后面再讨论嵌套路由
const routes = [
  {
    path: "/",
    name: "Home",
    component: Home,
  },
  {
    path: "/about",
    name: "About",
    component: () => import("@/views/demo/about.vue"),
  },
  {
    path: "/store",
    name: "Store",
    component: () => import("@/views/demo/store.vue"),
  },
  {
    path: "/style",
    name: "Style",
    component: () => import("@/views/demo/style.vue"),
  },
  {
    path: "/http",
    name: "Http",
    component: () => import("@/views/demo/http.vue"),
  },
  {
    path: "/svg-icon",
    name: "Svgicon",
    component: () => import("@/views/demo/svgicon.vue"),
  },
  {
    path: "/iconify",
    name: "Iconify",
    component: () => import("@/views/demo/iconify.vue"),
  },
];

// 3. 创建路由实例并传递 `routes` 配置
// 你可以在这里输入更多的配置，但我们在这里
// 暂时保持简单
const router = createRouter({
  // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式
  history: createWebHistory(),
  // `routes: routes` 的缩写
  routes,
});

export default router;
